const mysql = require("mysql");

var con = mysql.createConnection({
    host:"localhost",
    port:3306,
    user:"root",
    passwd:"ddd",
    database:"blog"
})

var obj = {};

obj.query = async (sqlStr,arr)=>{
    await new Promise((resolve,reject) => {
        con.query(sqlStr,arr,(err,result) => {
            if(err){
                reject(err);
            }else{
                resolve(result);
            }
        })
    })
}